// 判断是否登录
const isLogin = () => !!uni.getStorageSync("token");
// 获取token
const getToken = () =>uni.getStorageSync("token");
// 登录重定向
const checkLogin = () => {
	if (!isLogin()) {
		// 去登录页
		// 获取当前页
		const pages = getCurrentPages();
		const currentPage = pages[pages.length-1].route;
		uni.redirectTo({
			url: "/pages/login/login?redirectUrl=" + currentPage
		})
	}
}
// 清除登录缓存
const removeUserInfo = () => {
	uni.removeStorageSync("token")
	uni.removeStorageSync("openid")
	uni.removeStorageSync("uid")
}
export {
	isLogin,
	getToken,
	checkLogin,
	removeUserInfo
}